package dbPicasso::UI::Dialog;

sub show
{
	my $class = shift;
	my $dialog = shift;
	my $package = shift || __PACKAGE__;
	my $xmldef = shift || "$FindBin::Bin/dbpicasso.glade";
	my $sub = shift;

	my $dialogdef = Gtk2::GladeXML->new($xmldef, $dialog);
	$dialogdef->signal_autoconnect_from_package($package);

	my $objDialog = $dialogdef->get_widget($dialog);

	if (ref($sub))
	{
		$sub->($objDialog, $dialogdef);
	}

	$objDialog->show;
	$objDialog->run;
	$objDialog->destroy;
}

1;
